Skip to main content

🏓 Ping-Pong and Pair Programming 🖥️

· 2 min read
Lars Opitz
Passionate Software Craftsperson | Seasoned Agile Leader @ eBay

Ping-Pong

I really enjoy both activities and try to include them in my daily routine at work. Luckily, Ping-Pong also describes a certain pair programming technique, in which both pairing partners will switch their roles very often in small cycles.

So, how does it work?

1️⃣ Person A writes a small test - which will fail as there is no production code yet.
2️⃣ Person B takes over the keyboard and writes the production code fulfilling the tested (partial) requirement and hence makes the test pass.
3️⃣ Person B continues and writes the next small failing test for the (next part of the) requirement and hands over control to person A
4️⃣ Person A is now tasked with writing the production code, making the new test case pass.
5️⃣ Person A continues with writing the next failing test

These small steps are repeated over and over again - ping pong - ping pong - ping pong…

Whenever necessary, both persons would interrupt the flow to discuss the bigger picture and how the upcoming implementation fits into the application architecture. This can also mean longer sessions on a whiteboard.

I love the Ping-Pong method because it combines 2 agile development techniques, pair programming and test-driven development, keeps both partners active and builds a stronger bond between the paring partners. Besides that, the ping pong technique comes with all the benefits of pair programming, which I laid out in my post "Pair Programming just wastes resources…".

The Ping-Pong technique works both, in a co-located and also in a remote environment, depending on the tooling used. I recommend a local setup with 2 monitors, 2 mice and 2 keyboards connected to a single computer to be most efficient. This way, switching the role is as easy as stopping to type and starting it.

I’m curious to learn what you think about the Ping-Pong technique and pair programming in general.

Let's discuss!

Please let's discuss on LinkedIn.